package com.hzlx;

import com.hzlx.service.MqttMessageService;
import jakarta.annotation.Resource;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.stereotype.Component;

@Component
public class Subscriber {
    @Resource
    private MqttMessageService mqttMessageService;
@ServiceActivator(inputChannel = "mqttInputChannel")
    public void handleMessage(String payload){
    System.out.println("Received from PLC :"+payload);
    mqttMessageService.processAndSaveMessage(payload);
}
}
